package sy.po;

import java.util.List;

import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.ManyMany;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;

/**
 * 
 * @author 孙宇
 *
 */
@Table("t_role")
@Comment("角色表")
public class Role extends BaseModel {

	@Column
	@Comment("角色名称")
	@ColDefine(notNull = true, width = 100)
	private String name;

	@Column
	@Comment("角色描述")
	@ColDefine(width = 200)
	private String description;

	// 用户集合，多对多关联，一个用户可以有多个角色，一个角色也可以属于多个用户
	@ManyMany(from = "roleId", relation = "t_user_role", target = User.class, to = "userId")
	private List<User> users;

	// 一对一关联
	@Column
	@Comment("公司主键")
	private String companyId;
	@One(field = "companyId", target = Company.class)
	private Company company;// 公司对象

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

}
